feat: reuse existing Devin sessions when resolving conflicts#26711
feat: reuse existing Devin sessions when resolving conflicts#26711anikdhabal merged 6 commits intomainfrom
Conversation
- Check if PR was created through Devin and use that session - Check PR comments for existing active Devin sessions - Send message to existing session instead of creating new one - Only create new session if no active session exists - Update comment message to reflect whether session is new or reused Co-Authored-By: anik@cal.com <adhabal2002@gmail.com>
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
…ions - Added 'Devin AI is addressing Cubic AI' to session patterns - Now checks for both conflict resolution and Cubic AI review sessions Co-Authored-By: anik@cal.com <adhabal2002@gmail.com>
There was a problem hiding this comment.
2 issues found across 1 file
Prompt for AI agents (all issues)
Check if these issues are valid — if so, understand the root cause of each and fix them.
<file name=".github/workflows/devin-conflict-resolver.yml">
<violation number="1" location=".github/workflows/devin-conflict-resolver.yml:263">
P2: Potential TypeError if `comment.body` is null. Use optional chaining to safely access the body, consistent with the `prBody?.match()` pattern used earlier.</violation>
<violation number="2" location=".github/workflows/devin-conflict-resolver.yml:280">
P2: The `break` statement is placed outside the active status check, causing the loop to exit even when a found session is inactive. This prevents finding other potentially active sessions from earlier comments. Either remove the `break` to check all sessions, or move it inside the success case.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
Devin AI is addressing Cubic AI's review feedbackNew feedback has been sent to the existing Devin session. |
- Add optional chaining for comment.body to prevent TypeError - Remove break statement to allow checking all comments for active sessions Co-Authored-By: anik@cal.com <adhabal2002@gmail.com>
…tps://git-manager.devin.ai/proxy/github.com/calcom/cal.com into devin/1768098824-conflict-resolver-session-reuse
| : `### Devin AI is resolving merge conflicts | ||
|
|
||
| This PR has new merge conflicts with the \`${pr.base_ref}\` branch. The existing Devin session has been notified to resolve them. | ||
|
|
||
| [View Devin Session](${sessionUrl})`; | ||
|
|
||
| await github.rest.issues.createComment({ | ||
| owner, | ||
| repo, | ||
| issue_number: pr.number, | ||
| body: commentBody |
There was a problem hiding this comment.
DevinAI, can you explain why you made this change from the previous one? Is it needed?
There was a problem hiding this comment.
Yes, this change is needed to differentiate between two scenarios:
- New session created: The original comment says "A Devin session has been created to automatically resolve them" and lists all the steps Devin will take
- Existing session reused: The new shorter comment says "The existing Devin session has been notified to resolve them"
This distinction is important because:
- When reusing an existing session, we're just sending a message to an already-running session, not creating a new one
- The shorter message avoids redundantly listing all the steps again (the user already saw those when the session was first created)
- It makes it clear to PR reviewers that no new session was spawned - we're just continuing work in the existing one
This follows the same pattern used in cubic-devin-review.yml (lines 224-226) which also has different comment messages for new vs. existing sessions.
There was a problem hiding this comment.
DevinAI No, we don’t want a refactor here. Keep it as it is, like before. The only change I want is: when a new session is created, show “A Devin session has been created to automatically resolve them,” and if not, show “The existing Devin session has been notified to resolve them.”
There was a problem hiding this comment.
Good point! I've updated the code to keep the same full comment structure for both cases. Now both new and existing session comments will show the complete list of what Devin will do, with only the status message differing:
- New session: "A Devin session has been created to automatically resolve them."
- Existing session: "The existing Devin session has been notified to resolve them."
Pushed in commit 16b1fa8.
- Both new and existing session comments now show the full list of what Devin will do - Only the status message differs: 'created' vs 'notified' Co-Authored-By: anik@cal.com <adhabal2002@gmail.com>
…26711) * feat: reuse existing Devin sessions when resolving conflicts - Check if PR was created through Devin and use that session - Check PR comments for existing active Devin sessions - Send message to existing session instead of creating new one - Only create new session if no active session exists - Update comment message to reflect whether session is new or reused Co-Authored-By: anik@cal.com <adhabal2002@gmail.com> * feat: also check for Cubic AI review sessions when reusing Devin sessions - Added 'Devin AI is addressing Cubic AI' to session patterns - Now checks for both conflict resolution and Cubic AI review sessions Co-Authored-By: anik@cal.com <adhabal2002@gmail.com> --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
What does this PR do?
Updates the
devin-conflict-resolver.ymlworkflow to reuse existing Devin sessions instead of always creating new ones when a PR has merge conflicts. This follows the same pattern used incubic-devin-review.yml.The workflow now:
Updates since last revision
comment.body(Cubic AI review feedback)breakstatement to allow checking all comments for active sessions when earlier sessions are inactive (Cubic AI review feedback)Mandatory Tasks (DO NOT REMOVE)
How should this be tested?
This is a GitHub Actions workflow change. To test:
Human Review Checklist
findExistingSession()correctly prioritizes PR body session over comment sessions['working', 'blocked', 'resumed']) matches expected Devin API statuses'Devin AI is resolving merge conflicts'for conflict resolution'Devin AI is addressing Cubic AI'for Cubic AI reviews/v1/sessions/{id}for status,/v1/sessions/{id}/messagefor messaging)Optional chaining for(fixed)comment.bodyto prevent TypeErrorLoop continues checking all comments when a session is inactive(fixed)